package com.school.admin.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.school.admin.common.result.QueryVo;
import com.school.admin.common.result.R;
import com.school.admin.entity.SysOperateLog;
import com.school.admin.service.SysOperateLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 操作日志 前端控制器
 * </p>
 *
 * @author sunpx
 * @since 2022-03-24
 */
@RestController
@RequestMapping("/sys-operate-log")
@Api(tags = "日志相关")
public class SysOperateLogController {


    @Autowired
    private SysOperateLogService sysOperateLogService;

    @PostMapping("queryLogPage")
    @ApiOperation("查询日志列表")
    public R queryLogPage(@RequestBody QueryVo<SysOperateLog> queryVo) {
        Page page = sysOperateLogService.page(queryVo.getPage());
        return R.ok().data("list", page);
    }



    @GetMapping("getByLogId/{id}")
    @ApiOperation("查询日志详情")
    public R getByLogId(@PathVariable String id) {
        SysOperateLog byId = sysOperateLogService.getById(id);
        return R.ok().data("info", byId);
    }

}

